# ====================================================================

cmake_minimum_required(VERSION 3.13)

project(xmedia)

# ====================================================================

set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)

# ====================================================================

include_directories(include src/comm src/wrapper)

if(CMAKE_CL_64)
    link_directories(
        ${PROJECT_SOURCE_DIR}/lib/win/fdk-aac/x64
        ${PROJECT_SOURCE_DIR}/lib/win/opus/x64
        ${PROJECT_SOURCE_DIR}/lib/win/sdl/x64
        ${PROJECT_SOURCE_DIR}/lib/win/x264/x64
        )
else(CMAKE_CL_64)
    link_directories(
        ${PROJECT_SOURCE_DIR}/lib/win/fdk-aac/x86
        ${PROJECT_SOURCE_DIR}/lib/win/opus/x86
        ${PROJECT_SOURCE_DIR}/lib/win/sdl/x86
        ${PROJECT_SOURCE_DIR}/lib/win/x264/x86
        )
endif(CMAKE_CL_64)

# ====================================================================

add_executable(aac_decoder_test
    test/aac_decoder_test.cpp
    src/wrapper/audio_aac.cpp
    src/comm/fwave_pcm.cpp)
target_link_libraries(aac_decoder_test fdk-aac)

if(WIN32)
    target_link_options(aac_decoder_test PRIVATE /NODEFAULTLIB:LIBCMT)
endif(WIN32)

# ====================================================================

add_executable(aac_encoder_test
    test/aac_encoder_test.cpp
    src/wrapper/audio_aac.cpp
    src/comm/fwave_pcm.cpp)
target_link_libraries(aac_encoder_test fdk-aac)

if(WIN32)
    target_link_options(aac_encoder_test PRIVATE /NODEFAULTLIB:LIBCMT)
endif(WIN32)

# ====================================================================

add_executable(fwave_rpcm_test
    test/fwave_rpcm_test.cpp
    src/wrapper/audio_dev.cpp
    src/comm/fwave_pcm.cpp)
target_link_libraries(fwave_rpcm_test SDL2)

# ====================================================================

add_executable(fwave_rpcm_test2
    test/fwave_rpcm_test2.cpp
    src/wrapper/audio_dev.cpp
    src/comm/fwave_pcm.cpp)
target_link_libraries(fwave_rpcm_test2 SDL2)

# ====================================================================

add_executable(fwave_wpcm_test
    test/fwave_wpcm_test.cpp
    src/wrapper/audio_dev.cpp
    src/comm/fwave_pcm.cpp)
target_link_libraries(fwave_wpcm_test SDL2)

# ====================================================================

add_executable(fwave_wpcm_test1
    test/fwave_wpcm_test1.cpp
    src/wrapper/audio_dev.cpp
    src/comm/fwave_pcm.cpp)
target_link_libraries(fwave_wpcm_test1 SDL2)

# ====================================================================

add_executable(fwave_wpcm_test2
    test/fwave_wpcm_test2.cpp
    src/comm/fwave_pcm.cpp)

# ====================================================================

add_executable(opus_decoder_test
    test/opus_decoder_test.cpp
    src/wrapper/audio_opus.cpp
    src/comm/fwave_pcm.cpp)
target_link_libraries(opus_decoder_test opus)

if(WIN32)
    target_link_options(opus_decoder_test PRIVATE /NODEFAULTLIB:LIBCMT)
endif(WIN32)

# ====================================================================

add_executable(opus_encoder_test
    test/opus_encoder_test.cpp
    src/wrapper/audio_opus.cpp
    src/comm/fwave_pcm.cpp)
target_link_libraries(opus_encoder_test opus)

if(WIN32)
    target_link_options(opus_encoder_test PRIVATE /NODEFAULTLIB:LIBCMT)
endif(WIN32)

# ====================================================================

